"""
@file:   content
@author: FrankYi
@date:   2020/08/13
@desc:
"""
from .base import db


class ViewSouth(db.Model):
    __tablename__ = 'view_south'
    viewid = db.Column(db.Integer, primary_key=True, autoincrement=True)
    viewpic = db.Column(db.String)
    viewname = db.Column(db.String)
    viewdesc = db.Column(db.String)
    ranking = db.Column(db.Integer)
    comments = db.relationship('CommentSouth', backref='view')
    docs = db.relationship('DocSouth',backref='view')
    books = db.relationship('BookSouth',backref='view')




class DocSouth(db.Model):
    __tablename__ = 'doc_south'
    docid = db.Column(db.Integer, primary_key=True, autoincrement=True)
    viewid = db.Column(db.ForeignKey('view_south.viewid'))
    docpic = db.Column(db.String)
    docname = db.Column(db.String)
    docdesc = db.Column(db.String)



class BookSouth(db.Model):
    __tablename__ = 'book_south'
    bookid = db.Column(db.Integer, primary_key=True, autoincrement=True)
    viewid = db.Column(db.ForeignKey('view_south.viewid'))
    bookpic = db.Column(db.String)
    bookname = db.Column(db.String)
    bookdesc = db.Column(db.String)